/*
 * Copyright (C) 2009 Christoph Caks
 *
 * This file is part of GLWAK.
 *
 * GLWAK is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * GLWAK is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with GLWAK.  If not, see <http://www.gnu.org/licenses/>.
 *
 *
 * Context.h
 *
 *  Created on: 11.07.2009
 *      Author: Christoph Caks
 */

#ifndef CONTEXT_H_
#define CONTEXT_H_

#include "OpenGL.h"

#include "Initializeable.h"
#include "Disposable.h"
#include "Drawable.h"
#include "ContextConfiguration.h"

namespace glwak {
	class Context;
}

#include "Window.h"

namespace glwak {

/**
 * represents an OpenGL Context.
 */
class Context: public Initializeable {
public:
	Context();
	Context( Context *_shareContext );
	Context( Window *_window );

	virtual ~Context();

	void setConfiguration( ContextConfiguration _configuration );
	void setShareContext( Context* _context );
	void setDrawable( Drawable* _drawable );

	virtual void makeCurrent()=0;
	virtual void swapBuffers()=0;

	virtual void *getExtensionAddress( const char *_extension )=0;

protected:
	ContextConfiguration configuration;
	Drawable* drawable;

	Context* shareContext;

	int evaluateFormat( unsigned int bitsPerPixel, ContextConfiguration& configuration, int colorBits, int depthBits, int stencilBits, int antialiasing );


};

} // namespace glwak

#endif /* CONTEXT_H_ */
